provider Monitors POST /api/0/organizations/{organization_id_or_slug}/projects/{project_id_or_slug}/detectors/
@utdk/sentry /api/0/organizations/{organization_id_or_slug}/projects/{project_id_or_slug}/detectors/
Create a Monitor for a Project
Create a Monitor for a project
organization_id_or_slug path required
The ID or slug of the organization the resource belongs to.
string
project_id_or_slug path required
The ID or slug of the project the resource belongs to.
string

Try it

Authentication
Configure credentials for API Reference
Gateway
The gateway proxies requests and injects credentials server-side. Configure credentials above, then enter your gateway URL.

Saved automatically to browser storage.

createAMonitorForAProject
POST/api/0/organizations/{organization_id_or_slug}/projects/{project_id_or_slug}/detectors/
Create a Monitor for a project

Parameters

required

The ID or slug of the organization the resource belongs to.

required

The ID or slug of the project the resource belongs to.

Input

required

Name of the monitor.

required

The type of monitor - `metric_issue`.

The IDs of the alerts to connect this monitor to. Use the 'Fetch Alerts' endpoint to find the IDs.

The data sources for the monitor to use based on what you want to measure. **Number of Errors Metric Monitor** - `eventTypes`: Any of `error` or `default`. ```json [ { "aggregate": "count()", "dataset" : "events", "environment": "prod", "eventTypes": ["default", "error"], "query": "is:unresolved", "queryType": 0, "timeWindow": 3600, }, ], ``` **Users Experiencing Errors Metric Monitor** - `eventTypes`: Any of `error` or `default`. ```json [ { "aggregate": "count_unique(tags[sentry:user])", "dataset" : "events", "environment": "prod", "eventTypes": ["default", "error"], "query": "is:unresolved", "queryType": 0, "timeWindow": 3600, }, ], ``` **Throughput Metric Monitor** ```json [ { "aggregate":"count(span.duration)", "dataset":"events_analytics_platform", "environment":"prod", "eventTypes":["trace_item_span"] "query":"", "queryType":1, "timeWindow":3600, "extrapolationMode":"unknown", }, ], ``` **Duration Metric Monitor** ```json [ { "aggregate":"p95(span.duration)", "dataset":"events_analytics_platform", "environment":"prod", "eventTypes":["trace_item_span"] "query":"", "queryType":1, "timeWindow":3600, "extrapolationMode":"unknown", }, ], ``` **Failure Rate Metric Monitor** ```json [ { "aggregate":"failure_rate()", "dataset":"events_analytics_platform", "environment":"prod", "eventTypes":["trace_item_span"] "query":"", "queryType":1, "timeWindow":3600, "extrapolationMode":"unknown", }, ], ``` **Largest Contentful Paint Metric Monitor** - `dataset`: If a custom percentile is used, dataset is `transactions`. Otherwise, dataset is `events_analytics_platform`. - `aggregate`: Valid values are `avg(measurements.lcp)`, `p50(measurements.lcp)`, `p75(measurements.lcp)`, `p95(measurements.lcp)`, `p99(measurements.lcp)`, `p100(measurements.lcp)`, and `percentile(measurements.lcp,x)`, where `x` is your custom percentile. ```json [ { "aggregate":"p95(measurements.lcp)", "dataset":"events_analytics_platform", "environment":"prod", "eventTypes":["trace_item_span"] "query":"", "queryType":1, "timeWindow":3600, "extrapolationMode":"unknown", }, ], ``` **Custom Metric Monitor** - `dataset`: If a custom percentile is used, dataset is `transactions`. Otherwise, dataset is `events_analytics_platform`. - `aggregate`: Valid values are: `avg(x)`, where `x` is `transaction.duration`, `measurements.cls`, `measurements.fcp`, `measurements.fid`, `measurements.fp`, `measurements.lcp`, `measurements.ttfb`, or `measurements.ttfb.requesttime`. `p50(x)`, where `x` is `transaction.duration`, `measurements.cls`, `measurements.fcp`, `measurements.fid`, `measurements.fp`, `measurements.lcp`, `measurements.ttfb`, or `measurements.ttfb.requesttime`. `p75(x)`, where x is `transaction.duration`, `measurements.cls`, `measurements.fcp`, `measurements.fid`, `measurements.fp`, `measurements.lcp`, `measurements.ttfb`, or `measurements.ttfb.requesttime`. `p95(x)`, where x is `transaction.duration`, `measurements.cls`, `measurements.fcp`, `measurements.fid`, `measurements.fp`, `measurements.lcp`, `measurements.ttfb`, or `measurements.ttfb.requesttime`. `p99(x)`, where x is `transaction.duration`, `measurements.cls`, `measurements.fcp`, `measurements.fid`, `measurements.fp`, `measurements.lcp`, `measurements.ttfb`, or `measurements.ttfb.requesttime`. `p100(x)`, where `x` is `transaction.duration`, `measurements.cls`, `measurements.fcp`, `measurements.fid`, `measurements.fp`, `measurements.lcp`, `measurements.ttfb`, or `measurements.ttfb.requesttime`. `percentile(x,y)`, where `x` is `transaction.duration`, `measurements.cls`, `measurements.fcp`, `measurements.fid`, `measurements.fp`, `measurements.lcp`, `measurements.ttfb`, or `measurements.ttfb.requesttime`, and `y` is the custom percentile. `failure_rate()` `apdex(x)`, where `x` is the value of the Apdex score. `count()` ```json [ { "aggregate": "p75(measurements.ttfb)" "dataset": "events_analytics_platform", "queryType": 1, }, ],

The issue detection type configuration. - `detectionType` - `static`: Threshold based monitor - `percent`: Change based monitor - `dynamic`: Dynamic monitor - `comparisonDelta`: If selecting a **change** detection type, the comparison delta is the time period at which to compare against in minutes. For example, a value of 3600 compares the metric tracked against data 1 hour ago. - `300`: 5 minutes - `900`: 15 minutes - `3600`: 1 hour - `86400`: 1 day - `604800`: 1 week - `2592000`: 1 month **Threshold** ```json { "detectionType": "static", } ``` **Change** ```json { "detectionType": "percent", "comparisonDelta": 3600, } ``` **Dynamic** ```json { "detectionType": "dynamic", } ```

Issue detection configuration for when to create an issue and at what priority level. - `logicType`: `any` - `type`: Any of `gt` (greater than), `lte` (less than or equal), or `anomaly_detection` (dynamic) - `comparison`: Any positive integer. This is threshold that must be crossed for the monitor to create an issue, e.g. "Create a metric issue when there are more than 5 unresolved error events". - If creating a **dynamic** monitor, see the options below. - `seasonality`: `auto` - `sensitivity`: Level of responsiveness. Options are one of `low`, `medium`, or `high` - `thresholdType`: If you want to be alerted to anomalies that are moving above, below, or in both directions in relation to your threshold. - `0`: Above - `1`: Below - `2`: Above and below - `conditionResult`: The issue state change when the threshold is crossed. - `75`: High priority - `50`: Low priority - `0`: Resolved **Threshold and Change Monitor** ```json "logicType": "any", "conditions": [ { "type": "gt", "comparison": 10, "conditionResult": 75 }, { "type": "lte", "comparison": 10, "conditionResult": 0 } ], "actions": [] ``` **Threshold Monitor with Medium Priority** ```json "logicType": "any", "conditions": [ { type: "gt", comparison: 5, conditionResult: 75 }, { type: "gt", comparison: 2, conditionResult: 50 }, { type: "lte", comparison: 2, conditionResult: 0 } ], "actions": [] ``` **Dynamic Monitor** ```json "logicType": "any", "conditions": [ { "type": "anomaly_detection", "comparison": { "seasonality": "auto", "sensitivity": "medium", "thresholdType": 2 }, "conditionResult": 75 } ], "actions": [] ```

The ID user or team who owns the monitor or alert prefaced by the string 'user' or 'team'. **User** ```json "user:123456" ``` **Team** ```json "team:456789" ```

A description of the monitor. Will be used in the resulting issue.

Set to False if you want to disable the monitor.

Enter a gateway URL above to enable sending.

Code snippet
Updates live as you fill in the form above.

TypeScript

import sentry from '@utdk/sentry';

await sentry.createAMonitorForAProject()